<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="pull-right">
                        <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i> 添加商家</h3>
                    </div>
                    <div class="panel-body">
                        <form action="" method="post" onsubmit="return checkUserUpdate(this);" enctype="multipart/form-data">
                            <table class="table table-bordered">
                                <tbody>
                                    <tr>
                                        <td>手机号码：</td>
                                        <td>
                                            <input type="text" class="form-control" name="phone" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>商家LOGO：</td>
                                        <td>
                                            <input type="file" name="store_img">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="col-sm-2">商家名称：</td>
                                        <td>
                                            <input type="text" class="form-control" name="store_name" value="">
                                        </td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>登录密码：</td>
                                        <td>
                                            <input type="password" class="form-control" name="password">
                                        </td>
                                        <td>6-16位字母數字符號組合</td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <button type="submit" class="btn btn-info">
                                                <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                            </button>
                                            <input type="reset" class="btn btn-default pull-right" value="重置">
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function checkUserUpdate() {
        var phone = $('input[name="phone"]').val();
        var password = $('input[name="password"]').val();
        var error = '';
        if (password == '') {
            error += "密码不能为空\n";
        }
        if (password.length < 6 || password.length > 16) {
            error += "密码长度不正确\n";
        }
        if(!checkMobile(phone)){
            error += "你的手机号码格式不正确\n";
        }
        if (error) {
            layer.alert(error, {
                icon: 2
            });
            return false;
        }
        return true;
    }
</script>
</body>
</html>
